package com.zhang.framelib.datasource;

import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * 数据源工具类（多数据源）  这个需要研究
 * Title:MultipleDataSource
 * Description:
 * @Edit_Description:cuishuaiming
 * @version:zhang-framelib 1.0
 */
public class MultipleDataSource extends AbstractRoutingDataSource{
	 private static final ThreadLocal<String> DATA_SOURCE_KEY = new InheritableThreadLocal<String>();

	    public static void setDataSourceKey(String dataSource) {
	        DATA_SOURCE_KEY.set(dataSource);
	    }

	    @Override
	    protected Object determineCurrentLookupKey() {
	        return DATA_SOURCE_KEY.get();
	    }
}
